package com.vanysoft.framework.aop;

import com.vanysoft.framework.exception.VanySoftBaseException;
import com.vanysoft.framework.validation.VanySoftValidationErr;

import java.util.ArrayList;
import java.util.List;


public class VanySoftValidationException extends VanySoftBaseException {
    private static final long serialVersionUID = -3216323068354148358L;
    private String errCode;
    private List<VanySoftValidationErr> errList;

    public VanySoftValidationException(String errCode, List<VanySoftValidationErr> list) {
        this.errCode = errCode;
        this.errList = list;
    }

    public VanySoftValidationException(String msg) {
        List<VanySoftValidationErr> errList = new ArrayList<>();
        VanySoftValidationErr err = new VanySoftValidationErr();
        err.setField("");
        err.setMessage(new String[]{msg});
        errList.add(err);
        this.errCode = "validationErr";
        this.errList = errList;
    }

    @Override
    public String getErrCode() {
        return errCode;
    }

    @Override
    public void setErrCode(String errCode) {
        this.errCode = errCode;
    }

    public List<VanySoftValidationErr> getErrList() {
        return errList;
    }

    public void setErrList(List<VanySoftValidationErr> errList) {
        this.errList = errList;
    }
}
